//this head file is about to define common structure (e.g the recv_package)
#ifndef COMMON_H
	#define COMMON_H
typedef char                C1;
typedef signed char         S1;
typedef signed short        S2;
typedef signed int          S4;
typedef signed long long    S8;
typedef unsigned char       U1;
typedef unsigned short      U2;
typedef unsigned int        U4;
typedef unsigned long long  U8;

#pragma pack(1)

typedef struct pk_request
{
	U2 opt_code;
	//C1 *request_login;
	C1 username[20];
	C1 passwd[16];
}PK_REQUEST;

typedef struct pk_data
{
	U2 opt_code;
	U1 *data;
	U4 data_len;
	U4 data_number;
}PK_DATA;

typedef struct pk_ack
{
	U2 opt_code;
	S4 number;
}PK_ACK;

typedef struct pk_error
{
	U2 opt_code;
	U4 err_code;
}PK_ERROR;

typedef struct pk_iflive
{
	U2 opt_code;
	U4 rnd_number;
}PK_IFLIVE;

typedef struct pk_common
{
	U2 opt_code;
	U1 datas[1024];
}PK_COMMON;

#pragma pack()

//int pack_package(const void *package,PK_COMMON *cm_pack);

//int upack_package(const PK_COMMON *cm_pack,void *package);

int do_data(PK_COMMON *cm_pack,void **linklist);

int do_ack(PK_COMMON *cm_pack);

int do_iflive(PK_COMMON *cm_pack);

int live_confirm(int socketfd,const PK_IFLIVE *live,int pack_size);

#endif
